<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>北大青鸟官网切换效果</title>
		<style>
			li {
				list-style: none;
			}

			#shiftImg {
				height: 450px;
				max-width: 1500px;
				overflow: hidden;
				margin-left: -360px;
				position: relative;
			}

			#shiftImg #adv,
			#shiftImg #navImg {
				display: flex;
			}

			#shiftImg #adv li {
				display: none;
			}

			#shiftImg #adv li.current {
				display: block;
			}

			#shiftImg #navImg {
				height: 20px;
				width: 130px;
				background-color: rgba(100, 100, 100, 0.5);
				position: absolute;
				left: 1000px;
				bottom: 30px;
			}

			#shiftImg #navImg {
				height: 26px;
				line-height: 26px;
				margin: 0 auto;
			}

			#shiftImg #navImg li {
				height: 12px;
				width: 12px;
				border-radius: 50%;
				background-color: white;
				margin-left: 15px;
				text-align: center;
				margin-top: 7px;
			}

			#shiftImg #navImg li:hover {
				background-color: skyblue;
			}
		</style>
		<script>
			var index = 0;
			var timer;
			window.onload = function() {
				timer = window.setInterval(function() {
					restart();
				}, 1500);
			}
			function doStart(){
				timer = window.setInterval(function() {0
					restart();
				}, 1500);
			}

			function restart() {
				document.getElementById("adv").children[index].className = "";
				document.getElementById("navImg").children[index].style.backgroundColor = "white";
				index = ++index % 4;
				document.getElementById("adv").children[index].className = "current";
				document.getElementById("navImg").children[index].style.backgroundColor = "skyblue";
			}

			function stopAdv() {
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body>
		<div id="shiftImg">
			<ul id="adv" onmouseover="stopAdv()" onmouseout="doStart()">
				<li class="current" ><a href="#"><img src="1.png"
							alt=""></a></li>
				<li ><a href="#"><img src="2.jpg" alt=""></a></li>
				<li><a href="#"><img src="3.jpg" alt=""></a></li>
				<li><a href="#"><img src="4.png" alt=""></a></li>
			</ul>
			<ul id="navImg">
				<li style="background-color: skyblue;"></li>
				<li></li>
				<li></li>
				<li></li>
			</ul>
		</div>
	</body>
</html>
